package suiteTest;

import org.junit.runner.Runner;
import org.junit.runners.BlockJUnit4ClassRunner;
import org.junit.runners.Suite;
import org.junit.runners.model.InitializationError;

import java.util.Arrays;
import java.util.List;

/**
 * @author nick
 * 自定义套件
 */
public class MySuite extends Suite {
    //必须要有的一个有参构造方法
    public MySuite(Class<?> klass) throws InitializationError {
        super(klass, getRunners());
    }

    /**
     * 将要测试的类添加到这个方法中，已集合的方式返回
     * @return
     * @throws InitializationError
     */
    private static List<Runner> getRunners() throws InitializationError {
        return Arrays.asList(
                new BlockJUnit4ClassRunner(Test1.class),
                new BlockJUnit4ClassRunner(Test2.class),
                new BlockJUnit4ClassRunner(Test3.class)
        );
    }
}
